<template>
  <i
    @click="handleClick"
    :class="[
      `icon-container`,
      `iconfont`,
      `${fontIcon}`,
      `${disabled ? 'disabled' : ''}`,
    ]"
  ></i>
</template>

<script>
import iconMap from "@/assets/iconMap.js";
export default {
  name: "Icon",
  props: {
    type: {
      type: String,
      required: true,
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    fontIcon() {
      return iconMap[this.type];
    },
  },
  methods: {
    handleClick() {
      this.$emit("click");
    },
  },
};
</script>

<style scoped>
@import "//at.alicdn.com/t/c/font_5038814_psrze9npa2.css";
.icon-container {
  font-size: inherit;
}
</style>
